<template>
  <div id="app">
    <router-view/>
    <div class="taskBox" v-if="showFlag">
      <el-dropdown @visible-change="show">
          <span class="el-dropdown-link">
            <img  src="@/assets/任务进程.png" style="height:30px;width:30px">
          </span>
          <el-dropdown-menu slot="dropdown">
            <div style="padding:10px">
              <el-table :data="taskDesc" style="width: 100%" :show-header="false">
                <el-table-column prop="title" width="180">
                </el-table-column> 
                <el-table-column prop="value" align="center">
                  <template slot-scope="scope">
                    <b> {{scope.row.value}}</b>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-dropdown-menu>
        </el-dropdown>
    </div>
  </div>
</template>

<style lang="less">
// 全局css变量配置
:root{
  /* 主题色*/
  --objectColor:#2468F2;
  body{
    background-color: rgba(243, 244, 246, 1);
    padding: 0;
    margin: 0;
  }
  * {
    /* CSS初始化 */
    box-sizing: border-box;
    font-family: PingFang SC, Microsoft Yahei, sans-serif;
    //user-select: none;
  }
  a{
    text-decoration: none;
  }
  .taskBox{
    cursor: pointer;
    position: fixed;
    bottom: 50px;
    right: 50px;
    z-index: 9999;
    padding: 10px;
    background: #fff;
    background-color: #ffffff; /* 背景颜色 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    border-radius: 50%;
   
  }
   .boxcontent{
      display: flex;
      align-items: center;
    }
}
</style>
<script>
export default {
  data(){
    return{
      showFlag:true,
      taskDesc:[
        {
          type:'1',
          title:'当前任务总数',
          value:0,
        },
        {
          type:'2',
          title:'当前执行任务',
          value:0,
        },
        {
          type:'3',
          title:'当前等待任务数',
          value:0,
        },
        {
          type:'4',
          title:'指定任务总人数',
          value:0,
        },
        {
          type:'5',
          title:'等待任务总人数',
          value:0,
        },
        {
          type:'6',
          title:'周期内已完成任务数',
          value:0,
        },
      ]
    }
  },
  computed: {

  },
  methods:{
    show(flag){
      if(flag){
        this.getTaskInfo();
      }
    },
    //获取任务info
    getTaskInfo(){
      this.$axios.get('/api/services/hzsfjtai/task/taskDesc', {}).then(res => {
        if (res.data.code === 200) {
          console.log(123456,res.data.data);
          this.taskDesc[0].value=res.data.data.totalTasks;
          this.taskDesc[1].value=res.data.data.runningTasks;
          this.taskDesc[2].value=res.data.data.waitingTasks;
          this.taskDesc[3].value=res.data.data.totalPeoples;
          this.taskDesc[4].value=res.data.data.waitingPeoples;
          this.taskDesc[5].value=res.data.data.finishedTasks4Week;
        } else {
          this.$message(res.data.msg)
        }
      }).catch(err => {
        this.$message.error(err)
      })
    }
  },
  mounted() {
    const currentPath = window.location.href;
    console.log(12345,currentPath); // 输出当前路由的路径
    if(window.location.href.indexOf('aichat')>0){
      this.showFlag=false
    }
  }
}
</script>
